package com.itheima.web.interceptor;

import com.itheima.domain.db.Admin;

/**
 * @Author 请不要叫我高司令
 * @Date 2022/3/24 18:20
 * @Version 1.0
 */

// 线程绑定工具类
public class AdminHolder {

    private static final ThreadLocal<Admin> adminTL = new ThreadLocal<>();

    // 向线程绑定admin
    public static void set(Admin admin) {
        adminTL.set(admin);
    }

    // 从线程获取admin
    public static Admin get() {
        return adminTL.get();
    }

    // 移出线程绑定
    public static void remove() {
        adminTL.remove();
    }


}
